public class Solution5 {
    //137. 只出现一次的数字 II
    public int singleNumber(int[] nums) {
        int bitMap = 0;
        for (int i = 0; i < 32; i++) {
            int x = 0;
            for (int j = 0; j < nums.length; j++) {
                x += (nums[j] >> i) & 1;
            }
            if (x % 3 != 0) {
                bitMap |= (1 << i);
            }
        }
        return bitMap;
    }
}
